package 多线程进阶;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * 原子类的实现
 */
public class TestDemo1 {
    public static void main(String[] args) {
        AtomicInteger atomicInteger=new AtomicInteger(0);
        System.out.println(atomicInteger.incrementAndGet());//相当于++i
        System.out.println(atomicInteger.getAndIncrement());//相当于i++
        System.out.println(atomicInteger.decrementAndGet());//相当于--i
        System.out.println(atomicInteger.getAndDecrement());//相当于i--
    }
}
